<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<jsp:include page="Redir.jsp"></jsp:include>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<link href="<c:url value='/css/default.css'/>" rel="stylesheet"
	type="text/css" />
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript" src="js/jquery-1.8.2.min.js" ></script>
<script type="text/javascript" src="js/NumericOnly.js" ></script>
<script type="text/javascript" src="js/jquery.validate.min.js" ></script>
<fmt:setBundle basename="lang.message" />
<c:set var="t" value="true" />
<title><fmt:message key="showfacility.title" /></title>

<script type="text/javascript">
	(function($, W, D) {
		var JQUERY = {};

		JQUERY.UTIL = {
			setupFormValidation : function() {

				//form validation rules
				$("#FacilityForm").validate({
					rules : {
						name : "required",
						description : "required",
						type : "required",
						seatingCapacity : "required",
						status : "required"

					},
					messages : {
						name : "Please enter your name",
						description : "Please enter description",
						type : "Please enter type",
						seatingCapacity : "Please enter Seating Capacity",
						status : "Please enter Status"
					},
					submitHandler : function(form) {
						form.submit();
					}
				});
			}
		}

		//when the dom has loaded setup form validation rules document.createElement('script');
		//window.jQuery.fn.jquery------ $("#id").functionname(function(){........});
		$(D).ready(function($) {
			JQUERY.UTIL.setupFormValidation();
		});

	})(jQuery, window, document);
</script>


</head>

<body>
	<%@include file="Header.jsp"%>
	<div id="wrapper">
		<div id="page-wrapper">
			<div id="page">
				<%@include file="Menu.jsp"%>
				<div id="content">
					<form action="ProcessFacility" method=post id="FacilityForm">
						<h2>
							<fmt:message key="label.facility.add" />
						</h2>

						<table class="table-form">
							<tr>

								<td><fmt:message key="label.facility.name" /></td>
								<td><input type="text" name="name"
									value="${facilities.name}" size="15" maxlength="20"
									${action == 'edit' ? 'readonly="readonly"' : '' } /> <input
									type="hidden" name="action" value="${action}" /></td>
							</tr>
							<tr>
							<tr>
								<td><fmt:message key="label.facility.description" /></td>
								<td><input type="text" name="description"
									value="${facilities.description}" size=15 maxlength=255>
								</td>
							</tr>
							<tr>
								<td><fmt:message key="label.facility.type" /></td>
								<td><select name="type">
										<option value="ClassRoom"
											${ facilities.type == "ClassRoom" ? 'selected="selected"' : '' }>Class
											Room</option>
										<option value="DiscussionRoom"
											${ facilities.type == "Discussion" ? 'selected="selected"' : '' }>Discussion
											Room</option>
										<option value="MeetingRoom"
											${ facilities.type == "MeetingRoom"? 'selected="selected"' : '' }>Meeting
											Room</option>
										<option value="MSPH"
											${ facilities.type == "MSPH"? 'selected="selected"' : '' }>Multi
											Purpose Hall</option>
								</select></td>
							</tr>

							<tr>
								<td><fmt:message key="label.facility.seatingcapacity" /></td>
								<td><input type="text" name="seatingCapacity"
									value="${facilities.seatingCapacity}" class="numeric_field"
									size=15 maxlength=20></td>
							</tr>

							<tr>
								<td><fmt:message key="label.facility.status" /></td>
								<td><select name="status">
										<option value="0"
											${ facilities.status == 0 ? 'selected="selected"' : '' }>Inactive</option>
										<option value="1"
											${ facilities.status == 1 ? 'selected="selected"' : '' }>Active</option>
								</select></td>

							</tr>
						</table>


						<input type="submit" value="Submit" class="button-style">
						<input type="reset" value="Reset" class="button-style-cancel">
					</form>
				</div>				
			</div>
		</div>
	</div>
<%@include file="Footer.jsp"%>
</body>
</html>